home *** CD-ROM | disk | FTP | other *** search
/ Trusted Irix /B 4.0.4 / Trusted-Irix B-4.0.1.iso / dist / eoe1.idb / usr / include / sys / fs / efs_ino.h.z / efs_ino.h
C/C++ Source or Header  |  1992-04-03  |  4KB  |  108 lines

  1. /**************************************************************************
  2.  *                                      *
  3.  *          Copyright (C) 1988, Silicon Graphics, Inc.          *
  4.  *                                      *
  5.  *  These coded instructions, statements, and computer programs  contain  *
  6.  *  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
  7.  *  are protected by Federal copyright law.  They  may  not be disclosed  *
  8.  *  to  third  parties  or copied or duplicated in any form, in whole or  *
  9.  *  in part, without the prior written consent of Silicon Graphics, Inc.  *
  10.  *                                      *
  11.  **************************************************************************/
  12.  
  13. #ifndef    __EFS_INO_
  14. #define    __EFS_INO_
  15.  
  16. #ident "$Revision: 3.11 $"
  17.  
  18. /*
  19.  * Definitions for the on-volume version of extent filesystem inodes.
  20.  * Inodes consist of some number of extents, as contained in
  21.  * di_numextents.  When di_numextents exceeds EFS_DIRECTEXTENTS, then the
  22.  * extents are kept elsewhere.  ``Elsewhere'' is defined as a list of up
  23.  * to EFS_DIRECTEXTENTS contiguous blocks of indirect extents.  An
  24.  * indirect extent is an extent descriptor (bn,len) which points to the
  25.  * disk blocks holding the actual extents.  For direct extents, the
  26.  * ex_offset field contains the logical offset into the file that the
  27.  * extent covers.  For indirect extents the field
  28.  * di_u.di_extents[0].ex_offset contains the number of 
  29.  * indirect extents.
  30.  *
  31.  * Valid extents are determined by their ex_bn, ex_length, ex_offset.
  32.  * If the ex_bn is zero, then the tuple (ex_length, ex_offset) determine
  33.  * a ``hole'' in the file - namely, a section of the file which was never
  34.  * written, and is assumed to contain zeros.  If the ex_bn is non-zero, and
  35.  * if the ex_bn is less than fs_firstcg, or if the ex_bn is greater than or
  36.  * equal to the fs_size then the block # is out of range.  If the ex_length
  37.  * is zero or if the ex_length is larger than EFS_MAXEXTENTLEN, then the
  38.  * extent is bad.  If the (ex_offset, ex_length) tuple overlaps any other
  39.  * extent, then the extent is bad.
  40.  */
  41.  
  42. /*
  43.  * Layout of an extent, in memory and on disk.
  44.  * This structure is laid out to take exactly 8 bytes.
  45.  */
  46. typedef struct    extent {
  47. unsigned int    ex_magic:8,    /* magic # (MUST BE ZERO) */
  48.         ex_bn:24,    /* basic block # */
  49.         ex_length:8,    /* length of this extent, in bb's */
  50.         ex_offset:24;    /* logical bb offset into file */
  51. } extent;
  52.  
  53. /* # of directly mappable extents (also in fact # of possible indirect
  54.  * extents since these live in the direct extent table). 
  55.  */
  56. #define    EFS_DIRECTEXTENTS    12
  57.  
  58. /* The inode code expects to be able to handle indirect extents in ONE
  59.  * buffer. So impose a limit on the size of an indirect extent. 
  60.  * (Note this is a first minimum-change hack for long files. We'll
  61.  * probably remove the one-buffer restriction later, in which case
  62.  * EFS_MAXINDIRBBS can get larger).
  63.  */
  64.  
  65. #define EFS_MAXINDIRBBS 32
  66.  
  67. /*
  68.  * Therefore follows as the night the day a computable number for the
  69.  * maximum number of extents possible for an inode...
  70.  */
  71.  
  72. #define    EFS_MAXEXTENTS    ((EFS_DIRECTEXTENTS * EFS_MAXINDIRBBS * BBSIZE) \
  73.              / sizeof (struct extent))
  74.  
  75. /* # of inodes per page */
  76. #define    EFS_INODESPERPAGE    (NBPC / sizeof(struct efs_dinode))
  77.  
  78. /* maximum length of a single extent */
  79. #define    EFS_MAXEXTENTLEN    (256 - 8)
  80.  
  81. /*
  82.  * Extent based filesystem inode as it appears on disk.  The efs inode
  83.  * is exactly 128 bytes long.
  84.  */
  85. struct    efs_dinode {
  86.     ushort    di_mode;    /* mode and type of file */
  87.     short    di_nlink;        /* number of links to file */
  88.     ushort    di_uid;          /* owner's user id */
  89.     ushort    di_gid;          /* owner's group id */
  90.     off_t    di_size;         /* number of bytes in file */
  91.     time_t    di_atime;       /* time last accessed */
  92.     time_t    di_mtime;       /* time last modified */
  93.     time_t    di_ctime;       /* time created */
  94.     ulong    di_gen;        /* generation number */
  95.     short    di_numextents;    /* # of extents */
  96.     ushort    di_refs;    /* refrence count since last reorg */
  97.     union di_addr {
  98.         extent    di_extents[EFS_DIRECTEXTENTS];
  99.         dev_t    di_dev;    /* device for IFCHR/IFBLK */
  100.     } di_u;
  101. };
  102.  
  103. /* sizeof (struct efs_dinode), log2 */
  104. #define    EFS_EFSINOSHIFT        7
  105.  
  106. #endif    /* __EFS_INO_ */
  107.  
  108.